// ----------------------------------
// RSDK Project: Sonic 2
// Script Description: Sonic Cabaret Object
// Script Author: Christian Whitehead/Simon Thomley
// Unpacked by Rubberduckycooly's script unpacker
// ----------------------------------


// ========================
// Aliases
// ========================

private alias object.value0 : object.timer


// ========================
// Function Declarations
// ========================

reserve function Sonic Cabaret_DebugDraw
reserve function Sonic Cabaret_DebugSpawn



// ========================
// Function Definitions
// ========================

private function Sonic Cabaret_DebugDraw
	DrawSprite(0)
end function


private function Sonic Cabaret_DebugSpawn
	CreateTempObject(TypeName[Sonic Cabaret], 0, object.xpos, object.ypos)
end function


// ========================
// Events
// ========================

event ObjectUpdate
		object.animationTimer++
		if object.animationTimer == 45
			object.animationTimer = 0
			object.frame++
			if object.frame >= 4
				object.frame = 0
		end if
	end if
end event


event ObjectDraw
        DrawSprite(object.frame)
       end if
end event

event ObjectStartup   
	LoadSpriteSheet("GEMSTST/SONIC.gif")
        SpriteFrame(-8, -39, 28, 46, 0, 0)
        SpriteFrame(-8, -39, 30, 46, 29, 0)
        SpriteFrame(-8, -39, 32, 46, 60, 0)
        SpriteFrame(-8, -39, 30, 46, 29, 0)


	SetTableValue(TypeName[Sonic Cabaret], DebugMode_ObjCount, DebugMode_TypesTable)
	SetTableValue(Sonic Cabaret_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
	SetTableValue(Sonic Cabaret_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
	DebugMode_ObjCount++
end event


// ========================
// Editor Events
// ========================

event RSDKDraw
	DrawSprite()
end event


event RSDKLoad
	LoadSpriteSheet("GEMSTST/SONIC.gif")
        SpriteFrame(-16, -16, 84, 141, 1, 1)

	
	SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")
end event
